<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
    编写函数实现删除数组中用户指定的数值，没有指定的数值也要给出提示
-->

<script>

    var a = [1, 2, 3, 4, 6, 1, 4, 5]

    function deleteNumber(arr, deleteNumber) {

        if (arr.indexOf(deleteNumber) == -1) {
            return "指定删除的元素不存在"
        }

        while (arr.indexOf(deleteNumber) != -1) {
            //获取删除元素的索引
            var index = arr.indexOf(deleteNumber);
            arr.splice(index, 1)
        }

        return '删除完毕'
    }

    var msg = deleteNumber(a, 10)
    console.log("msg:" + msg);
    console.log(a);

</script>
</body>
</html>